import { createApp } from 'vue'
import './style.css'
import App from './App.vue'
import router from './router'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import { createPinia } from 'pinia'
import { useUserStore } from '@/stores/user'

const app = createApp(App)

// 1. 注册插件
const pinia = createPinia()
app.use(pinia)
app.use(router)
app.use(ElementPlus)

// 2. 获取用户状态（必须在pinia注册之后）
const userStore = useUserStore()
userStore.checkLoginStatus() // 页面刷新时检查token并更新状态

// 3. 挂载应用
app.mount('#app')

